﻿Partial Public Class PageSwitcher
    Inherits UserControl

    Public Sub New()
        InitializeComponent()
    End Sub

    Private Sub PageSwitcher_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Navigate(New Login())
    End Sub

    Public Shared Sub Navigate(ByVal nextPage As UserControl)
        Dim ps As PageSwitcher = CType(Application.Current.RootVisual, PageSwitcher)
        If ps.contentGrid.Children.Count > 0 Then
            ps.contentGrid.Children.Remove(ps.contentGrid.Children(0))
        End If
        ps.contentGrid.Children.Add(nextPage)

    End Sub

End Class
